﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;

namespace PIT.Labs.SharePoint.Extensions
{
    /// <summary>
    /// This class contains "<a href="http://msdn.microsoft.com/en-us/library/bb383977%28v=vs.90%29.aspx">Extension Methods</a>" for <see cref="Microsoft.SharePoint.SPUser"/>.
    /// </summary>
    public static class SPUserExtension
    {
        /// <summary>
        /// Returns the user id and user name delimited by ";#". This method is useful when comparing editor/author fields.
        /// </summary>
        /// <param name="spUser">Represents a user in Microsoft SharePoint Foundation.</param>
        /// <returns><see cref="String"/><br/>A string that contains the user id and name delimited by ";#".</returns>
        public static String ToCamlCompareString(this SPUser spUser)
        {
            return spUser.ID + SPFieldMultiColumnValue.Delimiter + spUser.Name;
        }

    }
}
